package com.gxa.saas.admin.config;

import com.gxa.saas.admin.filter.tokenFilter;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class LoginConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //addPathPatterns拦截的路径
        String[] addPathPatterns = {
                "/**"
        };
        //excludePathPatterns排除的路径/放行路径
        String[] excludePathPatterns = {
                "/doc.html","/admin/Login","/asserts/**","/swagger-resources/**","/webjars/**","/swagger-ui.html/**","/docs","/v3/**"
        };
        //创建用户拦截器对象并指定其拦截的路径和排除的路径
        registry.addInterceptor(new tokenFilter()).addPathPatterns(addPathPatterns).excludePathPatterns(excludePathPatterns);
    }

}
